﻿//解决IE6 和 IE7中不能通过hover自动转换样式的问题
$(":text").mouseover(function () {
    $(this).addClass("inputfocus");
}).mouseout(function () {
    $(this).removeClass("inputfocus");
});
$("textarea").mouseover(function () {
    $(this).addClass("inputfocus");
}).mouseout(function () {
    $(this).removeClass("inputfocus");
});
function ChangeNava(ID) {
    var childNava = document.getElementById("ul" + ID);
    var img = document.getElementById("img" + ID);
    if (childNava.style.display == "block") {
        childNava.style.display = "none";
        img.src = '/images/管理员页面/jia.png'
    }
    else {
        childNava.style.display = "block";
        img.src = '/images/管理员页面/-.png'
    }
}
function OpenPage(OpenUrl, GetValueControlID, GetStringControlID) {
    var Return = window.showModalDialog(OpenUrl, window, "dialogWidth=1200px;dialogHeight=800px;center=yes;resizable=yes;scroll=yes;");
    if (Return) {
        var Returns = Return.split('*');
        $("#" + GetValueControlID).val(Returns[0]);
        $("#" + GetStringControlID).val(Returns[1]);
    }
}
function ClearText(GetValueControlID, GetStringControlID) {
    $("#" + GetValueControlID).val("");
    $("#" + GetStringControlID).val("");
}

/**
*WindowMask 遮罩 开始

*使用：var mask=new WindowMask(); mask.show();
**/
function WindowMask(id) {
    if (id) {
        this.id = id;
        this.jqueryId = "#" + id
    } else {
        this.id = "windowMask"
        this.jqueryId = "#windowMask"
    }
    this.style = {
        "position": "absolute",
        "top": "0px",
        "left": "0px",
        "width": "100%",
        "background-color": "#333333",
        "opacity": " 0.5",
        "filter": "alpha(opacity=50)",
        "z-index": "99",
        "height": "0px"
    }
}
WindowMask.fn = WindowMask.prototype;
WindowMask.fn.init = function () { //初始化
    var style = "";
    if ($(window).height() > $(document).height()) {
        this.style.height = ($(window).height() - 5) + "px";
    } else {
        this.style.height = $(document).height() + "px";
    }
    for (var key in this.style) {
        style += key + ":" + this.style[key] + ";";
    }
    $("body").append("<div id=\"" + this.id + "\" style=\"" + style + "\" ></div>");
    $(window).resize(jQuery.proxy(this.resize, this));
}
WindowMask.fn.setStyle = function (cssJson) { //设置样式
    $(this.jqueryId).css(cssJson);
}
WindowMask.fn.setText = function (msg) { //设置文本
    var msgDIV = "<div style=\"margin-top:" + $(window).height() * 0.45 + "px; width:100%;text-align:center;color:#ffffff;font-weight:bold;\">" + msg + "</div>"
    $(this.jqueryId).html(msgDIV);
}
WindowMask.fn.setHTML = function (html) {  //设置html
    $(this.jqueryId).html(html);
}
WindowMask.fn.show = function (msg) {  //显示
    if ($(this.jqueryId).length == 0) {
        this.init();
    }
    if (msg) this.setText(msg);
    this.setStyle({ "display": "block" });
}
WindowMask.fn.hide = function () {
    this.setStyle({ "display": "none" });
}
WindowMask.fn.resize = function () { //遮罩随窗口改变
    if ($(window).height() > $(document).height()) {
        this.style.height = ($(window).height() - 5) + "px";
    } else {
        this.style.height = $(document).height() + "px";
    }
    this.setStyle({ "height": this.style.height });
}
